from time import sleep

from selenium.webdriver.common.by import By

from base import Base


class Page(Base):
    dianji=(By.ID,'com.kongfz.app:id/ll_nav4')
    dianji1=(By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.TextView[2]')
    dianji2='new UiSelector().resourceId("com.kongfz.app:id/flSearch")'
    shuru0=(By.ID,'com.kongfz.app:id/etContent')
    shuru=(By.XPATH,'android.widget.EditText[@text="商品名称 作者 出版社 ISBN"]')
    dianji3=(By.ID,'com.kongfz.app:id/rlSearch')
    dy1='new UiSelector().text("没有找到时间哦大佛价位哦i家佛i的精确结果，为您显示以下相关商品")'
    # 时间哦大佛价位哦i家佛i
    dy2=(By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.TextView')
    def gouwuchesousuoyweu(self,filename):
        self.loc_ele(self.dianji).click()
        sleep(2)
        self.loc_ele(self.dianji1).click()
        sleep(2)
        self.loc_ui_ele(self.dianji2).click()
        sleep(2)
        self.loc_ele(self.shuru0).send_keys(filename)
        sleep(2)
        self.loc_ele(self.dianji3).click()
        sleep(8)